package com.woniu.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.Date;

/**
 * 靶场
 * @TableName ctf_range
 */
@TableName(value ="ctf_range")
@Data
@AllArgsConstructor
@NoArgsConstructor

public class CtfRange {
    /**
     * 靶场镜像ID
     */
    private String rangeId;

    /**
     * 靶场名称
     */
    private String rangeName;

    /**
     * 存储路径
     */
    private String rangeUrl;

    /**
     * 靶场类型
     */
    private String rangeType;

    /**
     * 难易度(分值)
     */
    private Integer difficultyId;

    /**
     * 描述
     */
    private String rangeDesc;

    /**
     * 上传时间
     */
    private Date uploadTime;

    /**
     * 上传者
     */
    private String uploader;

    /**
     * 更新时间
     */
    private Date updateTime;

    /**
     * 更新人
     */
    private String updater;
    /**
     * 暴露端口
     */
    private String exposePort;
    /**
     * Minio的存储路径
     */
    private String minioUrl;
    /**
     * flag存储路径
     */
    private String flagPath;

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        CtfRange other = (CtfRange) that;
        return
            (this.getRangeId() == null ? other.getRangeId() == null : this.getRangeId().equals(other.getRangeId()))
            && (this.getRangeName() == null ? other.getRangeName() == null : this.getRangeName().equals(other.getRangeName()))
            && (this.getRangeUrl() == null ? other.getRangeUrl() == null : this.getRangeUrl().equals(other.getRangeUrl()))
            && (this.getRangeType() == null ? other.getRangeType() == null : this.getRangeType().equals(other.getRangeType()))
            && (this.getDifficultyId() == null ? other.getDifficultyId() == null : this.getDifficultyId().equals(other.getDifficultyId()))
            && (this.getRangeDesc() == null ? other.getRangeDesc() == null : this.getRangeDesc().equals(other.getRangeDesc()))
            && (this.getUploadTime() == null ? other.getUploadTime() == null : this.getUploadTime().equals(other.getUploadTime()))
            && (this.getUploader() == null ? other.getUploader() == null : this.getUploader().equals(other.getUploader()))
            && (this.getUpdateTime() == null ? other.getUpdateTime() == null : this.getUpdateTime().equals(other.getUpdateTime()))
            && (this.getUpdater() == null ? other.getUpdater() == null : this.getUpdater().equals(other.getUpdater()))
            && (this.getMinioUrl() == null ? other.getMinioUrl() == null : this.getMinioUrl().equals(other.getMinioUrl()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getRangeId() == null) ? 0 : getRangeId().hashCode());
        result = prime * result + ((getRangeName() == null) ? 0 : getRangeName().hashCode());
        result = prime * result + ((getRangeUrl() == null) ? 0 : getRangeUrl().hashCode());
        result = prime * result + ((getRangeType() == null) ? 0 : getRangeType().hashCode());
        result = prime * result + ((getDifficultyId() == null) ? 0 : getDifficultyId().hashCode());
        result = prime * result + ((getRangeDesc() == null) ? 0 : getRangeDesc().hashCode());
        result = prime * result + ((getUploadTime() == null) ? 0 : getUploadTime().hashCode());
        result = prime * result + ((getUploader() == null) ? 0 : getUploader().hashCode());
        result = prime * result + ((getUpdateTime() == null) ? 0 : getUpdateTime().hashCode());
        result = prime * result + ((getUpdater() == null) ? 0 : getUpdater().hashCode());
        result = prime * result + ((getMinioUrl() == null) ? 0 : getMinioUrl().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", rangeId=").append(rangeId);
        sb.append(", rangeName=").append(rangeName);
        sb.append(", rangeUrl=").append(rangeUrl);
        sb.append(", rangeType=").append(rangeType);
        sb.append(", difficultyId=").append(difficultyId);
        sb.append(", rangeDesc=").append(rangeDesc);
        sb.append(", uploadTime=").append(uploadTime);
        sb.append(", uploader=").append(uploader);
        sb.append(", updateTime=").append(updateTime);
        sb.append(", updater=").append(updater);
        sb.append(", minioUrl=").append(minioUrl);
        sb.append("]");
        return sb.toString();
    }
}